package kz.pompei.ifacer.model.widgets;

import java.io.PrintStream;
import java.util.UUID;

public class WidgetCheck extends Widget {
  public CheckState state = CheckState.EMPTY;
  public String label = "Галочка";
  public Align side = Align.LEFT;
  
  @Override
  protected void printFields(int offset, PrintStream out) {
    String s = space(offset);
    out.println(s + "<state v=\"" + state + "\"/>");
    out.println(s + "<side v=\"" + side + "\"/>");
    out.println(s + "<label><![CDATA[" + label + "]]></label>");
  }
  
  public WidgetCheck(UUID uuid) {
    super(uuid);
  }
  
  public WidgetCheck() {}
  
  @Override
  public Widget copy() {
    WidgetCheck ret = new WidgetCheck(uuid);
    assignTo(ret);
    return ret;
  }
  
  @Override
  public void assignTo(Widget widget) {
    checkWidget(widget, getClass());
    super.assignTo(widget);
    WidgetCheck w = (WidgetCheck)widget;
    w.state = state;
    w.label = label;
    w.side = side;
  }
}
